package com.ctrl.riveradministrator.mvp.view.activity.news;

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ctrl.riveradministrator.R;
import com.ctrl.riveradministrator.base.BaseListAdapter;
import com.ctrl.riveradministrator.base.BaseViewHolder;
import com.ctrl.riveradministrator.common.Constants;
import com.ctrl.riveradministrator.mvp.model.Bulletin;
import com.ctrl.riveradministrator.mvp.model.News;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.drawable.ProgressBarDrawable;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.common.ResizeOptions;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder;

public class NewsAdapter extends BaseListAdapter<News> {

    private Context context;
    private TextView title,time;
    private RelativeLayout content;

    public NewsAdapter(Context mContext) {
        super(mContext);
        this.context = mContext;
    }

    @Override
    public int getLayoutId() {
        return R.layout.news_item;
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    public void onBindItemHolder(BaseViewHolder holder, int position) {

        title = holder.getView(R.id.river_name_tv);
        time = holder.getView(R.id.time);
        content = holder.getView(R.id.content);

        News news = getDataList().get(position);
        title.setText(news.getNewsTitle());
        time.setText(news.getCreateTime());
        content.setOnClickListener(v -> mOnItemClickListener.onItemClick(news, position));
    }


}
